#!/usr/bin/ruby
# -*- ruby -*-
#
# http://www.reddit.com/r/dailyprogrammer/comments/1berjh/040113_challenge_122_easy_sum_them_digits/

ARGV.each do |o|
  i = o.to_i

  until 0 <= i && i < 10
    c = 0

    until i <= 0
      c += i % 10
      
      i /= 10
    end

    i = c
  end
  puts "#{o} => #{i}"
end
